Insertion of new Data

Week 7 - SQL

Created: 2022-12-22


Table in a database is a two-dimensional set of rows and columns,
columns = properties = columns
rows = instances of entity in table

You can insert multiple rows at a time by just listing them sequentially.
Insert statement with values for all columns

INSERT INTO mytable
VALUES (value_or_expr, another_value_or_expr,),
       (value_or_expr_2, another_value_or_expr_2,),;
INSERT INTO Customers (CustomerName, City, Country)
VALUES ('Cardinal', 'Stavanger', 'Norway');

Insertion of Specific Columns

INSERT INTO mytable
(column, another_column,)
VALUES (value_or_expr, another_value_or_expr,),
       (value_or_expr_2, another_value_or_expr_2,),